package com.young.weixin.model.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.young.weixin.model.enums.EWxMessageTypeEnum;

/**
 * 文本消息
 *
 * @author wangjiyu
 * @date 2021/10/5 17:05
 */
@XStreamAlias("xml")
public class WxTextMessage extends WxBaseMessage {
    /**
     * 消息内容
     */
    @XStreamAlias("Content")
    private String content;

    /**
     * 构造消息对象
     *
     * @param fromUser 发送人
     * @param toUser   接收人
     * @return 消息对象
     */
    @Override
    public WxTextMessage build(String fromUser, String toUser) {
        WxTextMessage message = new WxTextMessage();
        message.fillWxBaseMessage(fromUser, toUser, EWxMessageTypeEnum.TEXT);
        return message;
    }

    /**
     * 构造消息对象
     *
     * @param messageMapWrapper 参数map
     * @return 消息对象
     */
    @Override
    public WxTextMessage convert(WxMessageMapWrapper messageMapWrapper) {
        WxTextMessage message = new WxTextMessage();
        message.fillWxBaseMessage(messageMapWrapper);
        message.setContent(messageMapWrapper.getContent());
        return message;
    }

    public WxTextMessage() {
        super();
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }


}
